package com.itheima.config;

import com.itheima.interceptor.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //使用registry注册拦截器
        registry.addInterceptor(new MyInterceptor())
                .addPathPatterns("/user/**")//拦截路径
                .excludePathPatterns("/user/find*");//排除拦截
    }
}
